﻿using Sustainalytics.Entities;
using System;

namespace Sustainalytics.FTPReport.BusinessLogic
{
    public class ReportFTPDto
    {
        public Guid Id { get; set; }

        public Guid AccountId { get; set; }

        public string ServerAddress { get; set; }

        public int ServerPort { get; set; }

        public string Username { get; set; }

        public string Password { get; set; }

        public FtpServerTypeEnum FtpServerType { get; set; }

        public string DirectoryPath { get; set; }

        public static ReportFTP ToReportFTPEntity(ReportFTPDto input)
        {

            return new ReportFTP
            {
                Id = input.Id,
                AccountId = input.AccountId,
                ServerAddress = input.ServerAddress,
                ServerPort = input.ServerPort,
                Username = input.Username,                                
                Password = input.Password,
                FtpServerType = (int)input.FtpServerType,
                DirectoryPath = input.DirectoryPath,
            };
        }

        public static ReportFTPDto ToReportFTPDto(ReportFTP input)
        {

            return new ReportFTPDto
            {
                Id = input.Id,
                AccountId = input.AccountId,
                ServerAddress = input.ServerAddress,
                ServerPort = input.ServerPort,
                Username = input.Username,                               
                Password = input.Password,
                FtpServerType = (FtpServerTypeEnum)input.FtpServerType,
                DirectoryPath = input.DirectoryPath,
            };
        }
        
    }

    public enum FtpServerTypeEnum
    {
        Ftp = 1,
        FtpSSL = 2,
        FtpSSH = 3
    }
}
